<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title>{$meta_title}|OneChat管理平台</title>
    <link href="__ROOT__/Public/favicon.ico" type="image/x-icon" rel="shortcut icon">
    <link media="all" href="__STATIC__/bootstrap2.3.2/css/bootstrap.min.css" type="text/css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="__CSS__/base.css" media="all">
    <link rel="stylesheet" type="text/css" href="__CSS__/common.css" media="all">
    <link rel="stylesheet" type="text/css" href="__CSS__/module.css">
    <link rel="stylesheet" type="text/css" href="__CSS__/style.css" media="all">
    <link rel="stylesheet" type="text/css" href="__CSS__/{$Think.config.COLOR_STYLE}.css" media="all">
    <link rel="stylesheet" type="text/css" href="__CSS__/onechat.css" media="all">
    <link rel="stylesheet" href="__STATIC__/jquery/jquery-ui-1.12.1/jquery-ui.theme.min.css">
    <!--[if lt IE 9]>
    <script type="text/javascript" src="__STATIC__/jquery-1.10.2.min.js"></script>
    <![endif]--><!--[if gte IE 9]><!-->
    <script type="text/javascript" src="__STATIC__/jquery-2.0.3.min.js"></script>
    <script type="text/javascript" src="__JS__/jquery.mousewheel.js"></script>
    <script src="__STATIC__/jquery/jquery-ui-1.12.1/jquery-ui.min.js"></script>
    <!--<![endif]-->

    <script type="text/javascript" src="__STATIC__/bootstrap2.3.2/js/bootstrap.min.js"></script>
    <!-- Include x-editable files -->
    <link href="__STATIC__/bootstrap2.3.2/css/bootstrap-editable.css" rel="stylesheet">
    <script src="__STATIC__/bootstrap2.3.2/js/bootstrap-editable.js"></script>
    <block name="style"></block>
</head>
<body>
<!-- 头部 -->
<div class="header">
    <!-- Logo -->
    <span class="logo"></span>
    <!-- /Logo -->

    <!-- 主导航 -->
    <ul class="main-nav">
        <volist name="__MENU__.main" id="menu">
            <li class="{$menu.class|default=''}"><a href="{$menu.url|U}">{$menu.title}</a></li>
        </volist>
    </ul>
    <!-- /主导航 -->

    <!-- 用户栏 -->
    <div class="user-bar">
        <a href="javascript:;" class="user-entrance"></a>
        <ul class="nav-list user-menu hidden">
            <li class="manager">您好，<em title="{:session('user_auth.username')}">{:session('user_auth.username')}</em></li>
            <li><a href="{:U('User/updatePassword')}">修改密码</a></li>
            <li><a href="{:U('User/updateNickname')}">修改昵称</a></li>
            <li><a href="{:U('Public/logout')}">退出</a></li>
        </ul>
    </div>

    <!-- 快捷通道 -->
    <div class="btn-group pull-right">
        <button class="btn btn-mini">小工具</button>
        <button class="btn btn-mini dropdown-toggle" data-toggle="dropdown">
            <span class="caret"></span>
        </button>
        <ul class="dropdown-menu">
            <li><a id="cache-delete" title="清除缓存" href="#msgModal" data-toggle="modal"><i class="icon-cache"></i> 缓存清理</a></li>
            <li><a id="check_connect" title="检测微信公众号连通" href="#msgModal" data-toggle="modal"><i class="icon-cache"></i> 检测连通</a></li>

            <li><a id="to_homepage" title="查看站点首页" href="http://{$_SERVER['SERVER_NAME']}__ROOT__" target="_blank"><i class="icon-web"></i> 查看站点</a></li>
        </ul>
    </div>

    <!--  查看内容  -->
    <div class="btn-group pull-right">
        <button class="btn btn-mini">查看内容</button>
        <button class="btn btn-mini dropdown-toggle" data-toggle="dropdown">
            <span class="caret"></span>
        </button>
        <ul class="dropdown-menu">
            <li><a id="list_text" title="查看文本" href="#msgModal" data-toggle="modal"><i class="icon-cache"></i> 查看文本</a></li>
            <li><a id="list_articles" title="查看文章" href="#msgModal" data-toggle="modal"><i class="icon-cache"></i> 查看文章</a></li>
            <li><a id="list_category" title="查看分类" href="#msgModal" data-toggle="modal"><i class="icon-cache"></i> 查看分类</a></li>
        </ul>
    </div>
</div>
<!-- /头部 -->

<!-- Modal -->
<div id="msgModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">

</div>

<!-- 边栏 -->
<div class="sidebar">
    <!-- 子导航 -->
    <block name="sidebar">
        <div id="subnav" class="subnav">
            <notempty name="_extra_menu">
                {// 动态扩展菜单 //}
                {:extra_menu($_extra_menu,$__MENU__)}
            </notempty>
            <volist name="__MENU__.child" id="sub_menu">
                <!-- 子导航 -->
                <notempty name="sub_menu">
                    <notempty name="key"><h3><i class="icon icon-fold"></i>{$key}</h3></notempty>
                    <ul class="side-sub-menu">
                        <volist name="sub_menu" id="menu">
                            <li>
                                <a class="item" href="{$menu.url|U}">{$menu.title}</a>
                            </li>
                        </volist>
                    </ul>
                </notempty>
                <!-- /子导航 -->
            </volist>
        </div>
    </block>
    <!-- /子导航 -->
</div>
<!-- /边栏 -->

<!-- 内容区 -->
<div id="main-content">
    <div id="top-alert" class="fixed alert alert-error" style="display: none;">
        <button class="close fixed" style="margin-top: 4px;">&times;</button>
        <div class="alert-content">这是内容</div>
    </div>
    <div id="main" class="main">
        <block name="nav">
            <!-- nav -->
            <notempty name="_show_nav">
                <div class="breadcrumb">
                    <span>您的位置:</span>
                    <assign name="i" value="1" />
                    <foreach name="_nav" item="v" key="k">
                        <if condition="$i eq count($_nav)">
                            <span>{$v}</span>
                            <else />
                            <span><a href="{$k}">{$v}</a>&gt;</span>
                        </if>
                        <assign name="i" value="$i+1" />
                    </foreach>
                </div>
            </notempty>
            <!-- nav -->
        </block>

        <block name="body"> </block>
    </div>
    <div class="cont-ft">
        <div class="copyright">
            <div class="fl">感谢使用<a href="http://onechat.juexin.pro" target="_blank">OneChat&#8482;</a>管理平台</div>
            <div class="fr">Copyright ©2014-{:Date('Y',time())} 原印文化传媒  Base on <a href="http://www.onethink.cn" target="_blank">OneThink</a> V{$Think.const.ONETHINK_VERSION}</div>
        </div>
    </div>
</div>
<!-- /内容区 -->
<script type="text/javascript">
    (function(){
        var ThinkPHP = window.Think = {
            "ROOT"   : "__ROOT__", //当前网站地址
            "APP"    : "__APP__", //当前项目地址
            "PUBLIC" : "__PUBLIC__", //项目公共目录地址
            "DEEP"   : "{:C('URL_PATHINFO_DEPR')}", //PATHINFO分割符
            "MODEL"  : ["{:C('URL_MODEL')}", "{:C('URL_CASE_INSENSITIVE')}", "{:C('URL_HTML_SUFFIX')}"],
            "VAR"    : ["{:C('VAR_MODULE')}", "{:C('VAR_CONTROLLER')}", "{:C('VAR_ACTION')}"]
        }
    })();
</script>
<script type="text/javascript" src="__STATIC__/think.js"></script>
<script type="text/javascript" src="__JS__/common.js"></script>
<script type="text/javascript">
    +function(){
        var $window = $(window), $subnav = $("#subnav"), url;
        $window.resize(function(){
            $("#main").css("min-height", $window.height() - 130);
        }).resize();

        /* 左边菜单高亮 */
        url = window.location.pathname + window.location.search;
        url = url.replace(/(\/(p)\/\d+)|(&p=\d+)|(\/(id)\/\d+)|(&id=\d+)|(\/(group)\/\d+)|(&group=\d+)/, "");
        $subnav.find("a[href='" + url + "']").parent().addClass("current");

        /* 左边菜单显示收起 */
        $("#subnav").on("click", "h3", function(){
            var $this = $(this);
            $this.find(".icon").toggleClass("icon-fold");
            $this.next().slideToggle("fast").siblings(".side-sub-menu:visible").
                    prev("h3").find("i").addClass("icon-fold").end().end().hide();
        });

        $("#subnav h3 a").click(function(e){e.stopPropagation()});

        /* 头部管理员菜单 */
        $(".user-bar").mouseenter(function(){
            var userMenu = $(this).children(".user-menu ");
            userMenu.removeClass("hidden");
            clearTimeout(userMenu.data("timeout"));
        }).mouseleave(function(){
            var userMenu = $(this).children(".user-menu");
            userMenu.data("timeout") && clearTimeout(userMenu.data("timeout"));
            userMenu.data("timeout", setTimeout(function(){userMenu.addClass("hidden")}, 100));
        });

        /* 表单获取焦点变色 */
        $("form").on("focus", "input", function(){
            $(this).addClass('focus');
        }).on("blur","input",function(){
            $(this).removeClass('focus');
        });
        $("form").on("focus", "textarea", function(){
            $(this).closest('label').addClass('focus');
        }).on("blur","textarea",function(){
            $(this).closest('label').removeClass('focus');
        });

        // 导航栏超出窗口高度后的模拟滚动条
        var sHeight = $(".sidebar").height();
        var subHeight  = $(".subnav").height();
        var diff = subHeight - sHeight; //250
        var sub = $(".subnav");
        if(diff > 0){
            $(window).mousewheel(function(event, delta){
                if(delta>0){
                    if(parseInt(sub.css('marginTop'))>-10){
                        sub.css('marginTop','0px');
                    }else{
                        sub.css('marginTop','+='+10);
                    }
                }else{
                    if(parseInt(sub.css('marginTop'))<'-'+(diff-10)){
                        sub.css('marginTop','-'+(diff-10));
                    }else{
                        sub.css('marginTop','-='+10);
                    }
                }
            });
        }

        //边栏菜单折叠状态
        $('.side-sub-menu').css("display","none");
        $('.side-sub-menu > .current').parent().css("display","block");

    }();
</script>
<include file="Public/footjs" />
<block name="script"></block>
</body>
</html>
